#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int Series (int N) {
    return (3 * pow(N, 2) + N) / 2;
}


int main() {
    int N = 0;
    scanf("%d", &N);
    int ret = Series(N);
    printf("%d", ret);
    return 0;
}